Skip to content

Conversation

RogerSelwyn
Copy link
Contributor

Added docs for query builder based on old query helper docs. Two comments to make:

  1. Should this still be called ExperimentalQuery if it is now the recommended way of creating queries?
  2. Previously you could instantiate a query with a simple mailbox.new_query. Now you must:
from O365.utils import ExperimentalQuery
builder = ExperimentalQuery(protocol=account.protocol) # Which assume you have account available when needed
query = builder.xxxxxx

Would it be feasible to add the new builder method to ApiComponent?

@alejcas
Copy link
Member

alejcas commented Jul 7, 2025

There is not an easy way of introducing a breaking change… It should be experimental and advised for some time before changing the whole api. Otherwise I guess we’re making it difficult for users.

I think we can remove the old query and change the new one so it’s the default soon anyway

@RogerSelwyn
Copy link
Contributor Author

I assume I can just reference QueryBuilder instead of ExperimentalQuery which I imagine won’t get removed in the future?

@alejcas
Copy link
Member

alejcas commented Jul 7, 2025

If you look into the code ExperimentalQuery is just an alias:

https://github.com/O365/python-o365/blob/master/O365/utils/__init__.py#L12

I will remove this alias in the future.

Just use QueryBuilder like you said

@alejcas
Copy link
Member

alejcas commented Sep 5, 2025

@RogerSelwyn thinking of setting the new Query as a default. What do you think?

@RogerSelwyn
Copy link
Contributor Author

It;s fine for me, I already migrated. Just need to note a breaking change in the change log. The challenge will be where people don't have the version of O365 pinned.

Alternatively, include a deprecation warning in the logs for a few months.

@alejcas
Copy link
Member

alejcas commented Sep 5, 2025

It;s fine for me, I already migrated. Just need to note a breaking change in the change log. The challenge will be where people don't have the version of O365 pinned.

Alternatively, include a deprecation warning in the logs for a few months.

The deprecation warning is in place since June 2025 (O365 version 2.1.4)
The new Query object exists since April 2025 (O365 version 2.1.2)

@alejcas
Copy link
Member

alejcas commented Sep 5, 2025

I'll change the default Query to the new one for the moment but keep the old one as well

@alejcas
Copy link
Member

alejcas commented Sep 5, 2025

@RogerSelwyn I've dropped setup.py completely (requirement.txt, etc.) and use the new pyproject.tml with uv:

eff184c

The problem is that I broke the github action to build the pages as it was using ‎requirements-pages.txt and I deleted it.

Do you mind helping me moving the github action to use uv and pyproject.toml?

@RogerSelwyn
Copy link
Contributor Author

OK, so I will have to learn UV, probably time for me to anyway then I can do the same to my own projects. A next week task probably. Then I'm away for a week, 12-19.

@RogerSelwyn
Copy link
Contributor Author

The deprecation warning is in place since June 2025 (O365 version 2.1.4) The new Query object exists since April 2025 (O365 version 2.1.2)

Probably didn't see it because I had migrated...

I'll change the default Query to the new one for the moment but keep the old one as well

Good plan...

@RogerSelwyn
Copy link
Contributor Author

@alejcas latest commit on here should build pages correctly when merged. I can move to separate PR if required.

@RogerSelwyn
Copy link
Contributor Author

I noted these errors in my test build. I can fix them in this or a separate PR if needed.

/home/runner/work/python-o365/python-o365/O365/excel.py:docstring of O365.excel.WorkSheet.update_cells:5: ERROR: Unexpected indentation. [docutils]
/home/runner/work/python-o365/python-o365/docs/source/usage/sharepoint.rst:14: WARNING: Inline emphasis start-string without end-string. [docutils]

@RogerSelwyn
Copy link
Contributor Author

First one requires the indentation removing from the fish line of the docs in the update_cells method.

Second one should likely be this in sharepoint.rst:

Note that using the :code:`.All` scopes is way less secure than granting permissions to specific sites and using
:code:`Sites.Selected scope`.

@alejcas
Copy link
Member

alejcas commented Sep 9, 2025

Thank you very much @RogerSelwyn.

I will merge this but the docs added here mention ExperimentalQuery and this no longer exist. It's QueryBuilder.

@RogerSelwyn
Copy link
Contributor Author

Thank you very much @RogerSelwyn.

I will merge this but the docs added here mention ExperimentalQuery and this no longer exist. It's QueryBuilder.

Changed it

@alejcas
Copy link
Member

alejcas commented Sep 9, 2025

I noted these errors in my test build. I can fix them in this or a separate PR if needed.

/home/runner/work/python-o365/python-o365/O365/excel.py:docstring of O365.excel.WorkSheet.update_cells:5: ERROR: Unexpected indentation. [docutils]
/home/runner/work/python-o365/python-o365/docs/source/usage/sharepoint.rst:14: WARNING: Inline emphasis start-string without end-string. [docutils]

Wow, I don't understand this. Seems like the indentation is correct (or as correct as in other methods in the same file)
Do you know where the problem is?

@RogerSelwyn
Copy link
Contributor Author

I think I'd have to go back and look in-depth at the Sphinx/ReadTheDocs documentation. I think in some places you just get away with doing it wrong. I don't think you are supposed to indent, but sometimes it allows it.

@alejcas
Copy link
Member

alejcas commented Sep 9, 2025

I think I'd have to go back and look in-depth at the Sphinx/ReadTheDocs documentation. I think in some places you just get away with doing it wrong. I don't think you are supposed to indent, but sometimes it allows it.

Sphinx is great but very complicated for me. Also I hate rst format, would love markdown.
But it is what it is.

Should l merge this then as it is?

@RogerSelwyn
Copy link
Contributor Author

Give me 5 mins, I'll see if I can include those docs fixed in this PR

@RogerSelwyn
Copy link
Contributor Author

You should be good to go now

@alejcas alejcas merged commit 586ea7b into O365:master Sep 9, 2025
@alejcas
Copy link
Member

alejcas commented Sep 9, 2025

Thanks!

@RogerSelwyn RogerSelwyn deleted the query-docs branch September 9, 2025 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants